@file:Suppress("UNCHECKED_CAST", "USELESS_CAST", "INAPPLICABLE_JVM_NAME", "UNUSED_ANONYMOUS_PARAMETER", "NAME_SHADOWING", "UNNECESSARY_NOT_NULL_ASSERTION")
package uni.UNIF42C880
import io.dcloud.uniapp.*
import io.dcloud.uniapp.extapi.*
import io.dcloud.uniapp.framework.*
import io.dcloud.uniapp.runtime.*
import io.dcloud.uniapp.vue.*
import io.dcloud.uniapp.vue.shared.*
import io.dcloud.uts.*
import io.dcloud.uts.Map
import io.dcloud.uts.Set
import io.dcloud.uts.UTSAndroid
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import io.dcloud.uniapp.extapi.getStorage as uni_getStorage
import io.dcloud.uniapp.extapi.navigateTo as uni_navigateTo
import io.dcloud.uniapp.extapi.saveImageToPhotosAlbum as uni_saveImageToPhotosAlbum
import io.dcloud.uniapp.extapi.shareWithSystem as uni_shareWithSystem
import io.dcloud.uniapp.extapi.showToast as uni_showToast
open class GenPagesResultResult : BasePage {
    constructor(__ins: ComponentInternalInstance, __renderer: String?) : super(__ins, __renderer) {
        onLoad(fun(options: OnLoadOptions) {
            this.loadImageList()
        }
        , __ins)
    }
    @Suppress("UNUSED_PARAMETER", "UNUSED_VARIABLE")
    override fun `$render`(): Any? {
        val _ctx = this
        val _cache = this.`$`.renderCache
        return createElementVNode("view", utsMapOf("class" to "result-container"), utsArrayOf(
            createElementVNode("view", utsMapOf("class" to "image-container"), utsArrayOf(
                createElementVNode("text", utsMapOf("class" to "tilte-text"), toDisplayString(_ctx.showingImageDateTime), 1),
                createElementVNode("image", utsMapOf("src" to _ctx.showingImagePath, "mode" to "aspectFit", "class" to "result-image"), null, 8, utsArrayOf(
                    "src"
                ))
            )),
            createElementVNode("swiper", utsMapOf("class" to "results-swiper", "display-multiple-items" to "3", "previous-margin" to "10px", "next-margin" to "10px"), utsArrayOf(
                createElementVNode("swiper-item", utsMapOf("class" to normalizeClass(utsArrayOf(
                    "result-thumb-item",
                    utsMapOf("active" to (_ctx.currentIndex === 0))
                )), "onClick" to fun(){
                    _ctx.selectImage(0)
                }
                ), utsArrayOf(
                    createElementVNode("text", utsMapOf("class" to "result-thumb-leftup-text"), "原图")
                ), 10, utsArrayOf(
                    "onClick"
                ))
            )),
            createElementVNode("view", utsMapOf("class" to "action-buttons"), utsArrayOf(
                createElementVNode("button", utsMapOf("class" to "action-btn save-btn", "onClick" to _ctx.saveImage), "保存", 8, utsArrayOf(
                    "onClick"
                )),
                createElementVNode("button", utsMapOf("class" to "action-btn share-btn", "onClick" to _ctx.shareImage), "分享", 8, utsArrayOf(
                    "onClick"
                )),
                createElementVNode("button", utsMapOf("class" to "action-btn retry-btn", "onClick" to _ctx.retryGeneration), "生成", 8, utsArrayOf(
                    "onClick"
                ))
            ))
        ))
    }
    open var showingImagePath: String by `$data`
    open var showingImageDateTime: String by `$data`
    open var showingOrigin: String by `$data`
    open var showingSeed: String by `$data`
    open var currentIndex: Number by `$data`
    open var resultImages: UTSArray<ResultImage1> by `$data`
    open var styleArray: UTSArray<Number> by `$data`
    open var imageList: UTSArray<ResultImage1> by `$data`
    @Suppress("USELESS_CAST")
    override fun data(): Map<String, Any?> {
        return utsMapOf("showingImagePath" to "", "showingImageDateTime" to "00:00", "showingOrigin" to "", "showingSeed" to "", "currentIndex" to 0, "resultImages" to utsArrayOf<ResultImage1>(), "styleArray" to utsArrayOf(
            0,
            0,
            0,
            0,
            0,
            0
        ), "imageList" to utsArrayOf<ResultImage1>())
    }
    open var selectImage = ::gen_selectImage_fn
    open fun gen_selectImage_fn(index: Number) {
        this.currentIndex = index
    }
    open var saveImage = ::gen_saveImage_fn
    open fun gen_saveImage_fn() {
        uni_saveImageToPhotosAlbum(SaveImageToPhotosAlbumOptions(filePath = this.showingImagePath, success = fun(_){
            uni_showToast(ShowToastOptions(title = "保存成功", icon = "success"))
        }
        , fail = fun(_){
            uni_showToast(ShowToastOptions(title = "保存失败，请检查权限", icon = "none"))
        }
        ))
    }
    open var shareImage = ::gen_shareImage_fn
    open fun gen_shareImage_fn() {
        uni_shareWithSystem(ShareWithSystemOptions(type = "image", imageUrl = this.showingImagePath, success = fun(_){
            console.log("分享成功")
        }
        , fail = fun(err){
            console.log("分享失败", err)
            uni_showToast(ShowToastOptions(title = "分享失败", icon = "none"))
        }
        ))
    }
    open var retryGeneration = ::gen_retryGeneration_fn
    open fun gen_retryGeneration_fn() {
        uni_navigateTo(NavigateToOptions(url = "/pages/edit/edit?image=" + JSON.stringify(let {
            object : UTSJSONObject() {
                var image = it.resultImages
                var index = it.currentIndex
            }
        })))
    }
    open var loadImageList = ::gen_loadImageList_fn
    open fun gen_loadImageList_fn() {
        uni_getStorage(GetStorageOptions(key = "imageList", success = fun(res){}))
        this.imageList = utsArrayOf(
            ResultImage1(imageID = "0001", imagePath = "/static/sampleimage.jpg", dateTime = "2025-6-11 14:30", children = utsArrayOf(
                childImage1(imageID = "0002", imagePath = "/static/sampleimage.jpg", dateTime = "2025-6-11 15:30", styleArray = utsArrayOf(
                    0,
                    0,
                    0,
                    0,
                    0,
                    0
                ), seed = "12345", sourceImagePath = "/static/sampleimage.jpg"),
                childImage1(imageID = "0003", imagePath = "/static/sampleimage.jpg", dateTime = "2025-6-11 16:30", styleArray = utsArrayOf(
                    1,
                    1,
                    1,
                    1,
                    1,
                    1
                ), seed = "22222", sourceImagePath = "/static/sampleimage.jpg")
            )),
            ResultImage1(imageID = "0004", imagePath = "/static/sampleimage.jpg", dateTime = "2025-6-10 14:30", children = utsArrayOf()),
            ResultImage1(imageID = "0005", imagePath = "/static/sampleimage.jpg", dateTime = "2025-6-9 14:30", children = utsArrayOf()),
            ResultImage1(imageID = "0006", imagePath = "/static/sampleimage.jpg", dateTime = "2025-6-4 14:30", children = utsArrayOf()),
            ResultImage1(imageID = "0007", imagePath = "/static/sampleimage.jpg", dateTime = "2025-6-3 14:30", children = utsArrayOf()),
            ResultImage1(imageID = "0008", imagePath = "/static/sampleimage.jpg", dateTime = "2025-6-2 14:30", children = utsArrayOf()),
            ResultImage1(imageID = "0009", imagePath = "/static/sampleimage.jpg", dateTime = "2025-5-30 14:30", children = utsArrayOf()),
            ResultImage1(imageID = "0010", imagePath = "/static/sampleimage.jpg", dateTime = "2025-5-29 14:30", children = utsArrayOf()),
            ResultImage1(imageID = "0011", imagePath = "/static/sampleimage.jpg", dateTime = "2025-5-28 14:30", children = utsArrayOf()),
            ResultImage1(imageID = "0012", imagePath = "/static/sampleimage.jpg", dateTime = "2024-5-28 13:30", children = utsArrayOf()),
            ResultImage1(imageID = "0013", imagePath = "/static/sampleimage.jpg", dateTime = "2024-5-28 12:30", children = utsArrayOf()),
            ResultImage1(imageID = "0014", imagePath = "/static/sampleimage.jpg", dateTime = "2024-5-28 11:30", children = utsArrayOf())
        )
    }
    companion object {
        val styles: Map<String, Map<String, Map<String, Any>>> by lazy {
            normalizeCssStyles(utsArrayOf(
                styles0
            ), utsArrayOf(
                GenApp.styles
            ))
        }
        val styles0: Map<String, Map<String, Map<String, Any>>>
            get() {
                return utsMapOf("result-container" to padStyleMapOf(utsMapOf("backgroundColor" to "#1f1f1f", "height" to "100%", "display" to "flex", "flexDirection" to "column", "paddingTop" to 0, "paddingRight" to 0, "paddingBottom" to 0, "paddingLeft" to 0)), "tilte-text" to padStyleMapOf(utsMapOf("fontSize" to 16, "color" to "#ffffff", "position" to "absolute", "top" to 10, "marginLeft" to "auto", "marginRight" to "auto")), "image-container" to padStyleMapOf(utsMapOf("width" to "100%", "height" to 250, "backgroundColor" to "#1f1f1f", "overflow" to "hidden", "display" to "flex", "justifyContent" to "center", "alignItems" to "center", "paddingTop" to 30)), "result-image" to padStyleMapOf(utsMapOf("width" to "100%", "height" to "100%")), "results-swiper" to padStyleMapOf(utsMapOf("width" to "100%", "height" to 100, "paddingBottom" to 0, "backgroundColor" to "#1f1f1f")), "result-thumb-item" to padStyleMapOf(utsMapOf("display" to "flex", "justifyContent" to "center", "alignItems" to "center", "boxSizing" to "border-box", "paddingTop" to 5, "paddingRight" to 5, "paddingBottom" to 5, "paddingLeft" to 5)), "result-thumb-item-text" to utsMapOf("" to utsMapOf("width" to "88%", "height" to 18, "paddingLeft" to 10, "position" to "absolute", "bottom" to 12, "fontSize" to 12, "color" to "#1f1f1f", "borderBottomLeftRadius" to 5, "borderBottomRightRadius" to 5), ".result-thumb-item.active " to utsMapOf("transform" to "scale(1.1)", "transitionDuration" to "0.3s", "transitionTimingFunction" to "ease", "color" to "#ffffff", "width" to "92%", "bottom" to 6, "height" to 20, "paddingTop" to 2, "borderBottomLeftRadius" to 8, "borderBottomRightRadius" to 8)), "result-thumb-leftup-text" to utsMapOf("" to utsMapOf("width" to "25%", "height" to 18, "position" to "absolute", "right" to 0, "top" to 10, "fontSize" to 12, "color" to "#1f1f1f"), ".result-thumb-item.active " to utsMapOf("transform" to "scale(1.1)", "transitionDuration" to "0.3s", "transitionTimingFunction" to "ease", "color" to "#ffffff", "bottom" to 0, "height" to 26, "paddingTop" to 2)), "result-thumb" to utsMapOf("" to utsMapOf("marginTop" to 0, "width" to "100%", "height" to 80, "borderTopLeftRadius" to 8, "borderTopRightRadius" to 8, "borderBottomRightRadius" to 8, "borderBottomLeftRadius" to 8, "borderTopWidth" to 2, "borderRightWidth" to 2, "borderBottomWidth" to 2, "borderLeftWidth" to 2, "borderTopStyle" to "solid", "borderRightStyle" to "solid", "borderBottomStyle" to "solid", "borderLeftStyle" to "solid", "borderTopColor" to "rgba(0,0,0,0)", "borderRightColor" to "rgba(0,0,0,0)", "borderBottomColor" to "rgba(0,0,0,0)", "borderLeftColor" to "rgba(0,0,0,0)"), ".result-thumb-item.active " to utsMapOf("transform" to "scale(1.1)", "transitionDuration" to "0.3s", "transitionTimingFunction" to "ease", "borderTopColor" to "#ffffff", "borderRightColor" to "#ffffff", "borderBottomColor" to "#ffffff", "borderLeftColor" to "#ffffff")), "info-panel" to padStyleMapOf(utsMapOf("backgroundColor" to "#1f1f1f", "borderTopWidth" to 2, "borderRightWidth" to 2, "borderBottomWidth" to 2, "borderLeftWidth" to 2, "borderTopStyle" to "solid", "borderRightStyle" to "solid", "borderBottomStyle" to "solid", "borderLeftStyle" to "solid", "borderTopColor" to "#2f2f2f", "borderRightColor" to "#2f2f2f", "borderBottomColor" to "#2f2f2f", "borderLeftColor" to "#2f2f2f", "borderTopLeftRadius" to 10, "borderTopRightRadius" to 10, "borderBottomRightRadius" to 10, "borderBottomLeftRadius" to 10, "paddingTop" to 15, "paddingRight" to 15, "paddingBottom" to 15, "paddingLeft" to 15, "marginTop" to 10, "marginRight" to 10, "marginBottom" to 10, "marginLeft" to 10)), "panel-title" to padStyleMapOf(utsMapOf("alignItems" to "center", "marginBottom" to 15)), "info-item" to padStyleMapOf(utsMapOf("display" to "flex", "flexDirection" to "row", "marginBottom" to 10)), "info-label" to padStyleMapOf(utsMapOf("width" to 80, "fontSize" to 14, "color" to "#eeeeee")), "info-image" to padStyleMapOf(utsMapOf("height" to 180, "flex" to 1, "fontSize" to 14, "color" to "#777777")), "info-value" to padStyleMapOf(utsMapOf("flex" to 1, "fontSize" to 14, "color" to "#777777")), "action-buttons" to padStyleMapOf(utsMapOf("marginTop" to 10, "display" to "flex", "flexDirection" to "row", "justifyContent" to "space-between")), "action-btn" to padStyleMapOf(utsMapOf("flex" to 1, "height" to 35, "lineHeight" to "35px", "textAlign" to "center", "borderTopLeftRadius" to 17.5, "borderTopRightRadius" to 17.5, "borderBottomRightRadius" to 17.5, "borderBottomLeftRadius" to 17.5, "marginTop" to 0, "marginRight" to 5, "marginBottom" to 0, "marginLeft" to 5, "fontSize" to 14)), "save-btn" to padStyleMapOf(utsMapOf("backgroundColor" to "#007AFF", "color" to "#ffffff")), "share-btn" to padStyleMapOf(utsMapOf("backgroundColor" to "#4CD964", "color" to "#ffffff")), "retry-btn" to padStyleMapOf(utsMapOf("backgroundColor" to "#FF9500", "color" to "#ffffff")), "@TRANSITION" to utsMapOf("result-thumb" to utsMapOf("duration" to "0.3s", "timingFunction" to "ease"), "result-thumb-item-text" to utsMapOf("duration" to "0.3s", "timingFunction" to "ease"), "result-thumb-leftup-text" to utsMapOf("duration" to "0.3s", "timingFunction" to "ease")))
            }
        var inheritAttrs = true
        var inject: Map<String, Map<String, Any?>> = utsMapOf()
        var emits: Map<String, Any?> = utsMapOf()
        var props = normalizePropsOptions(utsMapOf())
        var propsNeedCastKeys: UTSArray<String> = utsArrayOf()
        var components: Map<String, CreateVueComponent> = utsMapOf()
    }
}
